import request from '@/config/axios'
import type { Dayjs } from 'dayjs'

/** 客户档案-服务单元-组员信息 */
export interface CustomerArchiveServiceUnitMember {
  id: number // id
  serviceUnitId: number // 所属服务单元id
  name: string // 姓名
  skill: string // 技能
  duty: string // 职责
  messageReceiveMode: string // 接受消息方式
  ownerUserId: number // 负责人id
}

// 客户档案-服务单元-组员 API
export const CustomerArchiveServiceUnitMemberApi = {
  // 查询客户档案-服务单元-组员分页
  getCustomerArchiveServiceUnitMemberPage: async (params: any) => {
    return await request.get({ url: `/san/biz-customer-archive-service-unit-member/page`, params })
  },

  // 查询客户档案-服务单元-组员详情
  getCustomerArchiveServiceUnitMember: async (id: number) => {
    return await request.get({ url: `/san/biz-customer-archive-service-unit-member/get?id=` + id })
  },

  // 新增客户档案-服务单元-组员
  createCustomerArchiveServiceUnitMember: async (data: CustomerArchiveServiceUnitMember) => {
    return await request.post({ url: `/san/biz-customer-archive-service-unit-member/create`, data })
  },

  // 修改客户档案-服务单元-组员
  updateCustomerArchiveServiceUnitMember: async (data: CustomerArchiveServiceUnitMember) => {
    return await request.put({ url: `/san/biz-customer-archive-service-unit-member/update`, data })
  },

  // 删除客户档案-服务单元-组员
  deleteCustomerArchiveServiceUnitMember: async (id: number) => {
    return await request.delete({
      url: `/san/biz-customer-archive-service-unit-member/delete?id=` + id
    })
  },

  /** 批量删除客户档案-服务单元-组员 */
  deleteCustomerArchiveServiceUnitMemberList: async (ids: number[]) => {
    return await request.delete({
      url: `/san/biz-customer-archive-service-unit-member/delete-list?ids=${ids.join(',')}`
    })
  },

  // 导出客户档案-服务单元-组员 Excel
  exportCustomerArchiveServiceUnitMember: async (params) => {
    return await request.download({
      url: `/san/biz-customer-archive-service-unit-member/export-excel`,
      params
    })
  }
}
